classDiagram
    class Command {
        <<interface>>
        +execute(): void
        +undo(): void
    }
    class ConcreteCommandA {
        -receiver: Receiver
        +execute(): void
        +undo(): void
    }
    class ConcreteCommandB {
        -receiver: Receiver
        +execute(): void
        +undo(): void
    }
    class Receiver {
        +action(): void
    }
    class Invoker {
        -command: Command
        +setCommand(command: Command): void
        +executeCommand(): void
        +undoCommand(): void
    }
    class Client {
        +createCommand(receiver: Receiver) Command
    }

    Command <|.. ConcreteCommandA
    Command <|.. ConcreteCommandB
    ConcreteCommandA --> Receiver : uses
    ConcreteCommandB --> Receiver : uses
    Invoker --> Command : holds
    Client --> Command : creates
    Client --> ConcreteCommandA : creates
    Client --> ConcreteCommandB : creates
